{extend name="public/base" /}

{block name="style"}
<style>
    .temp-model {
        width: 100px;
        height: 40px;
        overflow: hidden;
    }
    .temp-model-img {
        width: 100%;
    }
</style>
{/block}

{block name="content"}
<div class="container-fluid">
    <div class="breadcrumb-wrapper row">
        <div class="col-12 col-lg-3 col-md-6">
            <h4 class="page-title">模板列表</h4>
        </div>
        <div class="col-12 col-lg-9 col-md-6">
            <ol class="breadcrumb float-right">
                <li><a href="{:url('Manage/home')}">控制台</a></li>
                <li class="active"> / 模板列表</li>
            </ol>
        </div>
    </div>
</div>

<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header border-bottom">
                    <a href="{:url('Temp/addTemp')}" class="btn btn-common">添加模板</a>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>编号</th>
                                <th>效果图</th>
                                <th>行业</th>
                                <th>类型</th>
                                <th>颜色</th>
                                <th>价格</th>
                                <th>链接</th>
                                <th>更新时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="datas" id="item"}
                            <tr>
                                <td>{$item.id}</td>
                                <td>PG00{$item.id}</td>
                                <td>
                                    <div class="temp-model">
                                        <a href="/uploads/{$item.temp_img}" target="_blank">
                                            <img src="/uploads/{$item.temp_img}" class="temp-model-img">
                                        </a>
                                    </div>
                                </td>
                                <td>{$item.cate_id|getCateName}</td>
                                <td>
                                    {eq name="$item.type_id" value="1"}
                                    电脑
                                    {else/}
                                    手机
                                    {/eq}
                                </td>
                                <td>
                                    <span style="padding: 0 1rem; background-color: #{$item.color_id|getColorValue}"></span>
                                </td>
                                <td>{$item.temp_price}</td>
                                <td>
                                    <input value="{$item.temp_link}" disabled>
                                    <a href="{$item.temp_link}" target="_blank">
                                        <span class="fa fa-link text-muted"></span>
                                    </a>
                                </td>
                                <td>{$item.update_time}</td>
                                <td>
                                    <a href="{:url('Temp/editTemp',['id'=>$item.id])}" class="btn btn-info btn-sm">
                                        <span class="lni-pencil"></span>
                                    </a>
                                    <a href="{:url('Temp/delTemp',['id'=>$item.id])}" class="btn btn-danger btn-sm" onclick="return confirm('确定删除此项?')">
                                        <span class="lni-trash"></span>
                                    </a>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="text-center">
    {$datas|raw}
</div>

{/block}